-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function setitem support with stride #57023
function setitem support with stride #57023
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
x_tmp[:, 2] = 20 | ||
|
||
np.testing.assert_allclose(x.numpy(), np_data) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we add test case of ellipsis index
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, add a case to test ellipsis index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* function setitem support with stride * fix ut * remove redundant dygraph checks * add unittest for basic slice output view * add Ellipsis case
PR types
Function optimization
PR changes
Others
Description
Pcard-66985
With the introduction of the stride mechanism in dygraph, and the relevant OPs output view has been enabled by default, indexing in Paddle needs to be adjusted accordingly.
In dygraph mode:
__getitem__
: Basic-indexing will output view of Tensor.__setitem__
: Advanced-indexing just assign value directly on the view of original Tensor, without an additional set_value. Moreover, we call set_value dygraph function instead of append_op, since the latter does not support the stride mechanism.